﻿using System;
using System.IO;
using SharpSqlAnalyzer.pp.output;

namespace SharpSqlAnalyzer.pp.print
{
	// Token: 0x0200025A RID: 602
	public class TextPrinter : IPrinter
	{
		// Token: 0x0600134E RID: 4942 RVA: 0x0031E7FC File Offset: 0x0031C9FC
		public virtual void print(TSourceTokenList tl)
		{
			for (int i = 0; i < tl.size(); i++)
			{
				TSourceToken tsourceToken = tl.get(i);
				if (tsourceToken.TokensBefore != null && tsourceToken.TokensBefore.size() > 0)
				{
					this.print(tsourceToken.TokensBefore);
				}
				if (tsourceToken.ReplaceToken != null)
				{
					this.print(tsourceToken.ReplaceToken);
				}
				else
				{
					this.print(tsourceToken);
				}
				if (tsourceToken.TokensAfter != null && tsourceToken.TokensAfter.size() > 0)
				{
					this.print(tsourceToken.TokensAfter);
				}
			}
		}

		// Token: 0x0600134F RID: 4943 RVA: 0x0031E883 File Offset: 0x0031CA83
		public virtual void print(TSourceToken t)
		{
			if (this.outputConfig != null)
			{
				this.@out.Write(this.outputConfig.renderHighlightingElement(t).ToString());
				return;
			}
			this.@out.Write(t.ToString());
		}

		// Token: 0x1700034F RID: 847
		// (get) Token: 0x06001350 RID: 4944 RVA: 0x0031E8BB File Offset: 0x0031CABB
		// (set) Token: 0x06001351 RID: 4945 RVA: 0x0031E8C3 File Offset: 0x0031CAC3
		public virtual TextWriter Out
		{
			get
			{
				return this.@out;
			}
			set
			{
				this.@out = value;
			}
		}

		// Token: 0x17000350 RID: 848
		// (set) Token: 0x06001352 RID: 4946 RVA: 0x0031E8CC File Offset: 0x0031CACC
		public virtual OutputConfig OutputConfig
		{
			set
			{
				this.outputConfig = value;
			}
		}

		// Token: 0x040013F8 RID: 5112
		private TextWriter @out = Console.Out;

		// Token: 0x040013F9 RID: 5113
		private OutputConfig outputConfig;
	}
}
